package com.smsc.headend.connector.service.impl;

import com.smsc.headend.connector.service.DeviceService;
import com.smsc.headend.connector.service.FeignAssetManagementService;
import com.smsc.headend.module.asset.dmo.ComConfigDMO;
import com.smsc.headend.module.asset.entity.ComEntity;
import com.smsc.headend.module.asset.entity.Meter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DeviceServiceImpl implements DeviceService {
    @Autowired
    FeignAssetManagementService assetManagementService;


    @Override
    public Long getModelId(ComEntity comEntity, Meter meter) {
        if (meter != null) {
            return meter.getModelId();
        }
        ComConfigDMO dmo = assetManagementService.getComConfigById(comEntity.getComId());
        return dmo.getModelId();
    }
}
